<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>驾考宝典</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
    <!--[if lt IE 9]>
    <script src="__JS__/html5shiv.min.js"></script>
    <script src="__JS__/respond.min.js"></script>
    <style>
        .login .login-form input {
            color: #000;
        }
    </style>
    <![endif]-->

    <script type="text/javascript">


        function register() {
            // 以下方式直接跳转
            window.location.href = '${pageContext.request.contextPath}/user/registerJsp';
        }
    </script>

</head>
<body class="login">
<div class="login-logo"><img src="${pageContext.request.contextPath}/static/images/logo.png" width="200" height="200"
                             alt="logo"/></div>
<form class="layui-form login-form" action="${pageContext.request.contextPath}/user/login" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" required lay-verify="required|phone" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" lay-verify="pass" required lay-verify="required" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit type="submit">登 录</button>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" onclick="register()">注 册</button>
        </div>
    </div>
</form>
<script>

    layui.use('form', function () {
        var form = layui.form;

        //各种基于事件的操作，下面会有进一步介绍
        //自定义验证规则
        form.verify({
            pass: [/(.+){6,12}$/, '密码必须6到12位']
        });
    });

</script>
</body>
</html>